<?php

namespace app\exam\validate;

use think\Validate;

/**
 * 套卷练习验证
 */
class Rollup extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'    =>    ['规则1','规则2'...]
     *
     * @var array
     */
    protected $rule = [
        'module_id' => 'require|number',
        'category'  => 'require|number',
        'rollup_id' => 'require|number',

    ];

    protected $field = [
        'module_id' => '版块',
        'category'  => '分类',
        'rollup_id' => '套卷',
    ];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名'    =>    '错误信息'
     *
     * @var array
     */
    protected $message = [
    ];

    /**
     * 验证场景
     */
    protected $scene = [
        'rollup_list'   => ['module_id'],
        'rollup_search' => ['module_id', 'category', 'title'],
        'rollup_detail' => ['rollup_id'],
        'rollup_answer' => ['rollup_id', 'answer_data', 'unique_code', 'time_takes'],
    ];

}
